<template>
	<view class="detail">
		<view class="title">
			{{data.name}}
		</view>
		<view class="time">
			{{data.time}}
		</view>
		<view class="content" v-html="getContent(data.detail)">

		</view>

	</view>
</template>

<script>
	import {
		KDetail
	} from '../../api/api.js'
	export default {
		data() {
			return {
				id: '',
				data: []
			}
		},
		onLoad(res) {
			this.id = res.id
			this.KDetail()

		},
		methods: {
			KDetail() {
				KDetail({
					id: this.id
				}).then(res => {
					this.data = res.data
				})
			},
			getContent(res) {
				if (typeof(res) == 'string') {
					// 正则替换
					res = res.replace(/src=\"\/ueditor\/php/g,
						'style="width:100%" src="' + this.websiteUrl + '/ueditor/php')
					return res = res.replace(/\<embed/g,
						'<embed  style="width:100%" ')
				}
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #f7f7f7;
	}

	.detail {
		.title {
			text-align: center;
			padding: 5%;
			font-weight: bold;
			font-size: 18px;
		}

		.time {
			font-size: 14px;
			color: #777;
			text-align: center;
		}

		.content {
			margin-top: 10px;
			width: 80%;
			padding: 5%;
			margin-left: 5%;
			background: #fff;
			border-radius: 8px;
			font-size: 14px;
			min-height: 300px;

		}

	}
</style>
